<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;

class IndexController extends AbstractController {
    /**
     * @Route("/index/index", name="index")
     * */
    public function index(){

        // 渲染模板文件
        return $this->render("index/index.html.twig", [
            'date' => date('Y-m-d H:i:s')
        ]);
    }

    /**
     * @Route("/index/{page}", name= "index_test", requirements={"page"="\d+"})
     * */
    public function test($page = 23){

        // url参数, 可以指定默认值, 以及参数规则
        return new Response(sprintf("Your Age Is %d", $page));
    }
}
